<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberAddressesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_addresses', function (Blueprint $table) {
            $table->id();
            $table->integer('member_id')->default(0)->comment('会员ID');
            $table->integer('province')->default(0)->comment('省份');
            $table->integer('city')->default(0)->comment('市');
            $table->integer('area')->default(0)->comment('区县');
            $table->string('address_info', 128)->default('')->comment('地址详情');
            $table->tinyInteger('is_default')->default(0)->comment('是否默认 0 否 1 是');
            $table->timestamps();
            $table->index('member_id');
        });
        DB::statement("ALTER TABLE `member_addresses` comment '会员地址表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_addresses');
    }
}
